import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpCourse {
  id!: number;
  title!: string;
  lecturerId?: number = 0;
  type!: number;
  img!: unknown;
  typeId!: number;
  tryContent?: unknown;
  content!: unknown;
  sort!: number;
  defaultView!: number;
  view!: number;
  isLike: boolean = true;
  defaultLike!: number;
  likeNum!: number;
  isAloneSale!: number;
  priceType!: boolean;
  price?: string;
  linePrice?: string;
  isRelationSale?: number;
  relationArr?: unknown;
  state!: boolean;
  termType!: boolean;
  termDay?: number;
  isTry!: boolean;
  tryTime?: number;
  isEwm!: boolean;
  ewmTitle!: string;
  ewm?: unknown;
  sendIntegral: number = 0;
  isDistribute!: boolean;
  aloneDistribute!: boolean;
  commissionType!: boolean;
  commission1?: string;
  commission2?: string;
  commission3?: string;
  screenStyle: boolean = true;
  isScreen!: boolean;
  isSpeedPlay!: boolean;
  isCopy!: boolean;
  menuStyle!: boolean;
  columnMenuStyle: boolean = true;
  uniacid!: number;
  posterType: boolean = true;
  poster?: unknown;
  addTime!: string;
  updateTime!: string;
  sales?: number = 0;
  liveType?: boolean;
  livePlayUrl?: unknown;
  livePlayType?: boolean;
  liveStartTime?: string;
  liveEndTime?: string;
  liveLookBack?: boolean;
  liveLookBackUrl?: unknown;
  liveImg?: unknown;
  liveState?: boolean;
  isTabRelation: boolean = false;
  isRelationCourse: boolean = false;
  relationCourseArr?: unknown;
  vipFreeSee: boolean = false;
  formId: number = 0;
}

export const ImsYzdKpCourseSchema = new EntitySchema({
  class: ImsYzdKpCourse,
  properties: {
    id: { primary: true, type: 'number' },
    title: { type: 'string', length: 255 },
    lecturerId: { type: 'number', nullable: true, default: 0 },
    type: { type: 'number', index: 'type' },
    img: { type: 'unknown', columnType: 'longtext' },
    typeId: { type: 'number', index: 'type_id' },
    tryContent: { type: 'unknown', columnType: 'longtext', nullable: true },
    content: { type: 'unknown', columnType: 'longtext' },
    sort: { type: 'number', index: 'sort' },
    defaultView: { type: 'number' },
    view: { type: 'number' },
    isLike: { type: 'boolean', default: true },
    defaultLike: { type: 'number' },
    likeNum: { type: 'number' },
    isAloneSale: { type: 'number' },
    priceType: { type: 'boolean' },
    price: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    linePrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    isRelationSale: { type: 'number', nullable: true },
    relationArr: { type: 'unknown', columnType: 'longtext', nullable: true },
    state: { type: 'boolean', index: 'state' },
    termType: { type: 'boolean' },
    termDay: { type: 'number', nullable: true },
    isTry: { type: 'boolean' },
    tryTime: { type: 'number', nullable: true },
    isEwm: { type: 'boolean' },
    ewmTitle: { type: 'string', length: 255 },
    ewm: { type: 'unknown', columnType: 'longtext', nullable: true },
    sendIntegral: { type: 'number', default: 0 },
    isDistribute: { type: 'boolean' },
    aloneDistribute: { type: 'boolean' },
    commissionType: { type: 'boolean' },
    commission1: {
      type: 'string',
      fieldName: 'commission_1',
      columnType: 'numeric(10,2)',
      nullable: true,
    },
    commission2: {
      type: 'string',
      fieldName: 'commission_2',
      columnType: 'numeric(10,2)',
      nullable: true,
    },
    commission3: {
      type: 'string',
      fieldName: 'commission_3',
      columnType: 'numeric(10,2)',
      nullable: true,
    },
    screenStyle: { type: 'boolean', default: true },
    isScreen: { type: 'boolean' },
    isSpeedPlay: { type: 'boolean' },
    isCopy: { type: 'boolean' },
    menuStyle: { type: 'boolean' },
    columnMenuStyle: { type: 'boolean', default: true },
    uniacid: { type: 'number', index: 'uniacid' },
    posterType: { type: 'boolean', default: true },
    poster: { type: 'unknown', columnType: 'longtext', nullable: true },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
    sales: { type: 'number', nullable: true, default: 0 },
    liveType: { type: 'boolean', nullable: true },
    livePlayUrl: { type: 'unknown', columnType: 'longtext', nullable: true },
    livePlayType: { type: 'boolean', nullable: true },
    liveStartTime: { type: 'string', length: 255, nullable: true },
    liveEndTime: { type: 'string', length: 255, nullable: true },
    liveLookBack: { type: 'boolean', nullable: true },
    liveLookBackUrl: { type: 'unknown', columnType: 'longtext', nullable: true },
    liveImg: { type: 'unknown', columnType: 'longtext', nullable: true },
    liveState: { type: 'boolean', nullable: true },
    isTabRelation: { type: 'boolean', default: false },
    isRelationCourse: { type: 'boolean', default: false },
    relationCourseArr: { type: 'unknown', columnType: 'longtext', nullable: true },
    vipFreeSee: { type: 'boolean', default: false },
    formId: { type: 'number', default: 0 },
  },
});
